package com.ease.map.geometry {
    import com.ease.map.Map;
    import com.ease.map.common.enum.GeoTypeEnum;
    import com.ease.map.geometry.basetype.Extent;
    import com.ease.map.style.IStyle;
    import flash.display.Sprite;
    import mx.collections.ArrayCollection;
    import com.ease.map.geometry.AbstractGeometry;
    import com.ease.map.geometry.IGeometry;
    import com.ease.map.geometry.ILineComposeGeometry;

    [Bindable]
    [RemoteClass(alias="com.kgis.map.model.geometry.LineComposeGeometry")]
    /**
     * 复杂线几何体   线+弧
     */
    public class LineComposeGeometry extends AbstractGeometry implements ILineComposeGeometry {
        private var _lineList:ArrayCollection = null;

        public function LineComposeGeometry() {
            super();
        }

        /**
         * 绘制几何体
         */
        override public function draw(sprite:Sprite, geoStyle:IStyle, map:Map):void {
            return;
        }

        override public function getExtent():Extent {
            var i:int = 0;
            var geoExtent:Extent = new Extent(0, 0, 0, 0);
            geoExtent.xmax = -999999999;
            geoExtent.xmin = 999999999;
            geoExtent.ymax = -999999999;
            geoExtent.ymin = 999999999;

            var subGeo:IGeometry = null;
            for (i = 0; i < this.lineList.length; i++) {
                subGeo = IGeometry(this.lineList.getItemAt(i));
                if (i == 0) {
                    geoExtent = subGeo.getExtent();
                }
                else {
                    geoExtent.extendFromBounds(subGeo.getExtent());
                }
            }
            return geoExtent;
        }

        override public function getGeometryType():int {
            return GeoTypeEnum.POLYLINECOMPOSEGEOMETRY;
        }

        /**简单线集合*/
        public function get lineList():ArrayCollection {
            return _lineList;
        }

        public function set lineList(value:ArrayCollection):void {
            _lineList = value;
        }

    }
}